<template>
  <div>
    <Table :columns="columns" :data="data" size="small" border />
  </div>
</template>

<script>
export default {
  name: 'WorktimeManagement',
  props: {
    data: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {
      columns: [
        { title: '部门', key: 'department', align: 'center', width: 120 },
        { title: '填报周期', key: 'week', align: 'center', width: 120 },
        { title: '工时(小时)', key: 'hours', align: 'center', width: 100 },
        { title: '状态', slot: 'status', align: 'center', width: 100 },
        { title: '操作', slot: 'action', fixed: 'right', width: 120, align: 'center' }
      ]
    };
  },
  methods: {
    getStatusColor(status) {
      const colorMap = {
        '已提交': 'success',
        '待提交': 'warning',
        '已审核': 'success',
        '待审核': 'warning'
      };
      return colorMap[status] || 'default';
    }
  }
};
</script>

<template slot-scope="{ row, index }" slot="status">
  <Tag :color="getStatusColor(row.status)" size="small">{{ row.status }}</Tag>
</template>

<template slot-scope="{ row, index }" slot="action">
  <!-- <Button size="small" type="primary" @click="viewDetails(row)">查看</Button>
  <Button size="small" type="success" @click="approveWorktime(row)" v-if="row.status === '待审核'">审核</Button> -->
</template> 